<?php
// +----------------------------------------------------------------------
// | LIKE [ JUST DO IT ]
// +----------------------------------------------------------------------
// | Author: Mr.hu <huhaiyang7788@163.com>
// +----------------------------------------------------------------------
// | DESC: 提供基础的使用方法，这里不做集成
// +----------------------------------------------------------------------


namespace common\controllers;



trait CommonBase
{

    /**
     * 获取请求的指定的参数
     * @param null $name
     * return void
     * @ Mr.hu.
     */
    public function get($name)
    {
        if(\Yii::$app->request->isPost){
            return \Yii::$app->request->post($name);
        }elseif(\Yii::$app->request->isGet){
            return \Yii::$app->request->get($name);
        }
    }

    /**
     * 文字转换
     * @param $key
     * return string
     * @ Mr.hu
     */
    public function language($key)
    {
        if($key){
            return \Yii::t('api',$key);
        }
    }


}